home *** CD-ROM | disk | FTP | other *** search
/ Nejlepší hry / Nejlepsi hry.iso / hry / sea of chaos / sea_install.msi / _15C39AAA7726369D39812BD40F01CF6A / _B05C0A9F10A64CA5A14EF9A21DA84E2A < prev    next >
Text File  |  2004-11-14  |  1KB  |  63 lines

  1. //rain cylendar vertex shader:
  2. //moves texture coordinates with time and angle
  3. //scales cylendar by specified amounts
  4. //Luke Lenhart
  5. //(C)2004-2005 Digipen Institute of Technology
  6.  
  7. //u tex coord modifier (should be varied from 0 to 1 with angle of camera)
  8. float uMod;
  9.  
  10. //scale of cylendar
  11. float4 scaleXYZ;
  12.  
  13. //alpha value of it all
  14. float alpha;
  15.  
  16. //world,view,projection transform
  17. float4x4 matWorldViewProj;
  18.  
  19. //current time (in seconds) since whenever
  20. float curTime;
  21.  
  22. //shader input
  23. struct VS_INPUT
  24. {
  25.    float4 Pos : POSITION;
  26.    float2 Tex0 : TEXCOORD0;
  27. };
  28.  
  29. //shader output
  30. struct VS_OUTPUT
  31. {
  32.    float4 Pos : POSITION;
  33.    float4 Color : COLOR;
  34.    float2 Tex0 : TEXCOORD0;
  35. };
  36.  
  37. //shader code
  38. VS_OUTPUT VShader(VS_INPUT In)
  39. {
  40.    VS_OUTPUT Out;
  41.    
  42.    //calc transformed position
  43.    float4 scaledPos=scaleXYZ*In.Pos;
  44.    Out.Pos=mul(matWorldViewProj, scaledPos);
  45.       
  46.    Out.Tex0=In.Tex0*float2(0.05f*pow(scaleXYZ.x,0.8),75.0f/pow(scaleXYZ.x,0.5f))+float2(uMod*In.Pos.z*40.0f,-2.0f*curTime*(45.0f/pow(scaleXYZ.x,0.7f)))+float2(scaleXYZ.x*0.001,0);
  47.  
  48.    //make vert color
  49.    Out.Color=float4(1,1,1,1);
  50.    
  51.    //if z is near 1, fade it out
  52.      if (In.Pos.z>=0.95f)
  53.    {
  54.       Out.Color.a=0.0f;
  55.    }
  56.    
  57.    //apply alpha
  58.    Out.Color.a*=alpha;
  59.  
  60.    //spit out the results
  61.    return Out;
  62. }
  63.